<template>
  <div class="killShop">
    <div class="serach">
      <div>
        是否显示:
        <el-select v-model="value" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </div>
      <div>
        商品名称:
        <el-select v-model="value" placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </div>
      <div class="shopsearch">
        <p>商品搜索:</p>
        <el-input v-model="input" placeholder="请输入内容"></el-input>
        <el-button>搜索</el-button>
      </div>
    </div>
    <div class="tables">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column fixed prop="id" label="ID" width="150"></el-table-column>
        <el-table-column prop="configuration" label="配置" width="120"></el-table-column>
        <el-table-column prop="secondsKillTime" label="秒杀时段" width="120"></el-table-column>
        <el-table-column prop="commodityImages" label="商品图片" width="120">
          <template slot-scope="scope">
                <img :src="scope.row.commodityImages" alt="" style="height:50px;" />
              </template>
        </el-table-column>
        <el-table-column prop="activityTitle" label="活动标题" width="300"></el-table-column>
        <el-table-column prop="eventProfile" label="活动简介" width="300"></el-table-column>
        <el-table-column prop="originalPrice" label="原价" width="120"></el-table-column>
        <el-table-column prop="secondsToBargain" label="秒杀价" width="120"></el-table-column>
        <el-table-column prop="limited" label="限量" width="120"></el-table-column>
        <el-table-column prop="residue" label="限量剩余" width="120"></el-table-column>
        <el-table-column prop="secondsKillState" label="秒杀状态" width="120">
          <span v-if="tableData.state=='1'">开启</span>
          <span else>关闭</span>
        </el-table-column>
        <el-table-column prop="state" label="状态" width="120">
          <template slot-scope="scope">
            <el-switch v-model="scope.row.state" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
          </template>
        </el-table-column>
        <el-table-column prop="creationTime" label="创建时间" width="120"></el-table-column>
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
            <el-button type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="block">
      <div></div>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="400"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    handleClick(row) {
      console.log(row);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  },
  created() {
    this.$api.shopkill().then(res => {
      this.tableData = res.data.list.slice(0, 5);
    });
  },
  data() {
    return {
      values: true,
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      tableData: [],
      options: [],
      value: "",
      input: ""
    };
  }
};
</script>

<style scoped lang='scss'>
.killShop {
  width: 100%;
  height: 100%;
  background: #fff;
	padding: 20px;
}
.serach {
  width: 100%;
  display: flex;
}
.tables {
  width: 100%;
  margin-top: 30px;
}
.el-table-colum {
  text-align: center;
}
.block {
  display: flex;
  justify-content: space-between;
}
.shopsearch {
  display: flex;
  align-items: center;
  p {
    flex-shrink: 0;
  }
}
</style>